package com.uobgroup.ews.uam.core.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.uobgroup.ews.uam.core.dao.ChangeLogDao;
import com.uobgroup.ews.uam.core.domain.ChangeLog;
import com.uobgroup.ews.uam.core.enums.OperateType;

@Service
@Transactional
public class ChangeLogServiceImpl implements ChangeLogService {

   @Autowired
   private ChangeLogDao changeLogDao;
   
   @Override
   public List<ChangeLog> findAll(int firstResult, int maxResult) {
      return changeLogDao.findAll(firstResult, maxResult);
   }

   @Override
   public void addNew(ChangeLog changeLog) {
      changeLogDao.save(changeLog);
   }

   @Override
   public Object findEntityById(Long id, Class<?> objectClass) {
      return changeLogDao.findEntityById(id, objectClass);
   }

   @Override
   public ChangeLog updateChangeLog(ChangeLog changeLog) {
      return changeLogDao.update(changeLog);
   }

   @Override
   public ChangeLog findById(Long id) {
      return changeLogDao.findOne(id);
   }

   @Override
   public Long count() {
      return changeLogDao.count();
   }

   @Override
   public List<ChangeLog> findAll() {
      return changeLogDao.findAll();
   }

   @Override
   public List<ChangeLog> find(OperateType operateType, String userId, Date fromDate, Date toDate, int firstResult, int maxResult){
      return changeLogDao.find(operateType, userId, fromDate, toDate, firstResult, maxResult);
   }

   @Override
   public Long count(OperateType operateType, String userId, Date fromDate, Date toDate) {
      return changeLogDao.count(operateType, userId, fromDate, toDate);
   }
}
